<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
		<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	    <meta name="HandheldFriendly" content="true">
		<title>欧元期权</title>
		<link rel="stylesheet" type="text/css" href="__OCSS__/reset.css"/>
		<link rel="stylesheet" type="text/css" href="__OCSS__/style.css"/>
		<link rel="stylesheet" type="text/css" href="__OCSS__/trend.css"/>
		<!--css-->
		<link href="__NEW__/option/css/bootstrap.css" rel="stylesheet" type="text/css" />
		<link href="__NEW__/option/css/propos.css" rel="stylesheet" type="text/css" />
		<link href="__NEW__/option/css/font.css" rel="stylesheet" type="text/css" />
		<!--js-->
		<script src="__NEW__/option/js/jquery-2.2.0.js" type="text/javascript" charset="utf-8"></script>
		<script src="__NEW__/option/js/touch.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="__CSS__/left.css"/>
		<link rel="stylesheet" type="text/css" href="__CSS__/svg.css"/>
		<script type="text/javascript" src="__OJS__/jquery-1.8.2.js"></script>
		{:hook('weixinshare',array('title'=>'欧元期权交易平台~','link'=>"$share_url",'desc'=>'我在期权交易平台盈利，快来一起参与吧！','imgUrl'=>"$headimgurl",'type'=>'','dataUrl'=>'','success_fun'=>'callback'))}
	</head>
	<body>
		<div id="doc"
	         class="doc"
	         data-config="{isLogin:true,tradeQuick:false,tradeType:2,tradeComm:'EC',tradeList:[{id:1,codefull:'CME EC 1606',exchange:'CME',commName:'',commCode:'EC',contCode:'EC1606',minuteList:[60,300,900,1800,3600],minuteCur:0,minuteShow:3,rateList:[70,72,75,78,80],moneyList:[100,200,500,1000,2000,5000,10000],moneyCur:0,moneyShow:3,priceUnit:'0.800',priceChange:'50.000',tradeTime:'15:00:00-24:00:00,00:00:00-04:00:00',closeTime:1451595300000,priceDigit:5,priceType:2,signed:1,state:1,isforeign:1,commValid:1},{id:2,codefull:'HKF HSI 1604',exchange:'HKF',commName:'',commCode:'HSI',contCode:'HSI1604',minuteList:[60,300,900,1800,3600],minuteCur:0,minuteShow:3,rateList:[70,72,75,78,80],moneyList:[100,200,500,1000,2000,5000,10000],moneyCur:0,moneyShow:3,priceUnit:'0.800',priceChange:'50.000',tradeTime:'09:15:00-12:00:00,13:00:00-16:15:00',closeTime:1451598900000,priceDigit:2,priceType:2,signed:1,state:1,isforeign:1,commValid:1}]}"
	         data-url-quote="//quote.jiaoyidaren.com/quote"
	         data-url-sline="//quote.jiaoyidaren.com/minute"

			 data-url-kline="//quote.jiaoyidaren.com/kline"
	         data-url-user-center="/m/mine"
	        >
			</div>
		<div class="qh-container">
			<div class="pub-box">
				<div class="header-box clearfix">
					<div class="header-left"><a href="{:U('Index/index')}" style="width:27px;height:27px;"><img src="__PUBLIC__/Futures/third/option/images/icon-10.png" width="100%"/></a></div>
					<div class="header-right">
						<a href="{:U('EuroOption/rules')}">交易规则</a>
					</div>
					<div class="header-slide">
						<div class="slide-up">
							 <a class="slide_arrow"><span>{$option['name']}</span><i class="icon icon_close"></i></a>
						</div>
						<div class="slide-down" style="display: none;">
							<ul>
								<!-- <li>恒生期权</li> -->
								<li><a href="{:U('StockOption/index')}">恒指期权</a></li>
								<li><a href="{:U('GoldOption/index')}">伦敦金期权</a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class="pub-content" style="display: block;">
					<div class="pub-park">
						<span>余额<span class="pub-yuen">{$money}</span></span><span class="ml30">持仓盈亏 <font class="pub-redcolor funding">0.00元</font></span>
					</div>
					<div class="pub-tab-menu clearfix">
						<ul>
							<li class="pub-cur"><a href="#">下单</a></li>
							<li><a href="#">持仓</a></li>
							<li><a href="#">结算</a></li>
						</ul>
						<div class="pub-tab-content">
							<!--下单-->
							<div class="pub-order-list">
								<div class="order-list-gro clearfix">
									<dl class="stock-data clearfix">
										<dd class="stock-title">欧元期权</dd>
										<dd class="stock-fund pub-redcolor">{$datas['last_price']}</dd>
										<dd class="stock-pool">
											<div class="plus pub-redcolor">{$datas['up']}</div>
											<div class="minus pub-redcolor">{$datas['ups']}%</div>
										</dd>
									</dl>
									<div class="stock-sale clearfix">
										<span class="text-left">卖价  &nbsp;&nbsp;&nbsp;  <em class="offer pub-redcolor">{$datas['sell_price']}</em></span>
										<span class="text-right">买价  &nbsp;&nbsp;&nbsp;  <em class="buying pub-redcolor">{$datas['buy_price']}</em></span>
									</div>
								</div>
								<div class="trend-chart" style="padding-bottom: 65px;">
									<!-- 分时曲线图 -->
					                <svg id="svgbox" class="svgbox" version="1.1" xmlns="http://www.w3.org/2000/svg">
							        	<g>
							        		<text x="5" y="453.6" fill="#888" style="text-anchor: start;font-size:8pt"><tspan>06:00</tspan></text>
							        		<text x="10" y="453.6" fill="#888" style="text-anchor: start;font-size:8pt"><tspan>12:00</tspan></text>
							        		<text x="116" y="453.6" fill="#888" style="text-anchor: start;font-size:8pt"><tspan>13:00</tspan></text>
							        		<text x="10" y="453.6" fill="#888" style="text-anchor: start;font-size:8pt"><tspan>04:00</tspan></text>
							        		<text x="20" y="155" fill="#d0402d" style="text-anchor: start;font-size:8pt"><tspan></tspan></text>
							        		<text x="20" y="155" fill="#d0402d" style="text-anchor: start;font-size:8pt"><tspan></tspan></text>
							        		<text x="20" y="155" fill="#d0402d" style="text-anchor: start;font-size:8pt"><tspan></tspan></text>

							        		<!--<text x="10" y="290" fill="#d0402d" style="text-anchor: start;font-size:8pt"><tspan>21147</tspan></text>
							        		<text x="10" y="362" fill="#d0402d" style="text-anchor: start;font-size:8pt"><tspan>21082</tspan></text>
							        		<text x="10" y="435" fill="#d0402d" style="text-anchor: start;font-size:8pt"><tspan>21032</tspan></text>-->
							        		<!--<line x1='' y1='' x2='' y2='' stroke="red" stroke-dasharray="3,3"></line>-->
							        	</g>
							        	<g>
							        		<path stroke="none" fill="#3083ca" fill-opacity="0.2" d="M 0,140 L150,140Z"></path><!--线-->
							        		<path stroke="#3083ca" fill="none" d="M 0,140 L150,140Z"></path><!--图-->
							        	</g>
							        	<g>

							        	</g>
							        </svg>

								</div>
								<!--看涨看跌按钮-->
								<div class="order-action">
									<span class="action-left xshow" data-val="1"><a  class="btn-left " >看涨</a></span>
									<span class="action-right xshow" data-val="0"><a  class="btn-right " >看跌</a></span>
								</div>
							</div>
							<!--持仓-->
							<div class="pub-order-list"  style="display: none;">

							</div>

							<!--结算成功-->
							<div class="pub-order-list" style="display: none;">
								<div data-page="1"></div>
								<a class="jiesuanas">加载更多...</a>
							</div>
					</div>

				</div>

			</div>
			<!--看涨-->
			<div id="see-up" style="display: none;">
				<div class="header-box clearfix">
					<div class="header-left"><a href="#"><img src="__OIMG__/icon-10.png" width="100%"/></a></div>
					<div class="header-slide">
						下单
					</div>
				</div>
				<ul class="main-list" style="padding-top: 50px;">
					<li>
						<div class="up-title"><!--恒生期权-HSI1603-->{$option['name']}-{$option['code']} 期权</div>
					</li>
					<li>
						<div class="up-title clearfix">
							<div class="list-left">到期时间</div>
							<div class="list-right timeshow">
								<a class="right-select"><img src="__OIMG__/icon-02.png" width="100%"/></a>
								<div class="dialog-right" style="display: none;">
									<div class="dialog-content">
										<ul class="timeclick"></ul>
									</div>
								</div>

							</div>
						</div>
					</li>
					<li>
						<div class="up-title">
							<div class="list-left">潜在收益率 <span class="pub-orangecolor" id="earn-rate">76%</span></div>
							<div class="list-right">
								潜在收益&nbsp;&nbsp;&nbsp;<span class="pub-orangecolor" id="earn">17.6元</span>
							</div>
						</div>
					</li>
					<li>
						<div class="up-title clearfix">
							<div class="list-left">投资金额</div>
							<div class="list-right2 mongyshow">
								<a class="right-select2"><img src="__OIMG__/icon-02.png" width="100%"/></a>
								<div class="dialog-right2" style="display: none;">
									<div class="dialog-content">
										<ul class="monyclick"></ul>
									</div>
								</div>
							</div>
						</div>
					</li>
				</ul>
				<div class="main-execute">
					<div class="up-title">
						<span class="input-radio">●</span>及时执行（最新执行价<em class="last">20566.00</em>）
					</div>

				</div>
				<div class="order-action" data-heyueid="{$option['id']}" data-zhangdie='1'>
					<span class="action-up order-click"><a href="#" class="btn-up ">确定看涨</a></span>
					<span class="action-down order-click" style="display: none;"><a href="#" class="btn-down ">确定看跌</a></span>
				</div>
			</div>
		</div>
		</div>
		<block name="left">
			<include file="Public/left"/>
		</block>
<!--提示成功-->
<div class="showmsgbox">
	<div class="showmsg">
		<div class="msg">执行成功！</div>
		<div class="msgok">确定</div>
	</div>
</div>

	</body>

	<script type="text/javascript">
window.onload=function(){


//首屏加载
var i = 0;
function refresh(){
	var timestamp = Date.parse(new Date());
	//ajax取值
	var url="{:U('UpdateEuro/update_index','','')}";
	url = url+'/_'+timestamp;
	$.ajax({
		type:"post",
		url:url,
		dataType:"json",
		async:true,
		success:function(datas){
			if(datas['up']<0){
				$('.plus').html(datas['up']);				//差值
				$('.minus').html(datas['ups']+"%");				//涨幅
				$('.stock-fund').removeClass('pub-redcolor pub-bluecolor').addClass('pub-bluecolor');
				$('.plus').removeClass('pub-redcolor pub-bluecolor').addClass('pub-bluecolor');
				$('.minus').removeClass('pub-redcolor pub-bluecolor').addClass('pub-bluecolor');
			}else{
				$('.plus').html("+"+datas['up']);				//差值
				$('.minus').html("+"+datas['ups']+"%");				//涨幅
				$('.stock-fund').removeClass('pub-bluecolor').addClass('pub-redcolor');
				$('.plus').removeClass('pub-bluecolor').addClass('pub-redcolor');
				$('.minus').removeClass('pub-bluecolor').addClass('pub-redcolor');
			}
			// $('.plus').html(datas['up']);				//差值
			// $('.minus').html(datas['ups']+"%");				//涨幅
			$('.offer').html(datas['sell_price']);		//卖价
			$('.buying').html(datas['buy_price']);		//买价
			if((datas['sell_price']-datas['open_price'])>0){
				$('.offer').removeClass('pub-bluecolor').addClass('pub-redcolor');
			}else{
				$('.offer').removeClass('pub-redcolor').addClass('pub-bluecolor');
			}
			if((datas['buy_price']-datas['open_price'])>0){
				$('.buying').removeClass('pub-bluecolor').addClass('pub-redcolor');
			}else{
				$('.buying').removeClass('pub-redcolor').addClass('pub-bluecolor');
			}
			var zhangdie=$('#see-up').find('.order-action').attr('data-zhangdie');//设置点击涨跌
			if(zhangdie==1){
				$('.last').html(datas['sell_price']);	//最新价 当前
			}else if(zhangdie==0){
				$('.last').html(datas['buy_price']);	//最新价 当前
			};
			$('.stock-fund').html(datas['last_price'])
//			console.log('跌/'+datas['buy_price']+'--涨/'+datas['sell_price']+'--实时/'+datas['last_price']);
//			$('.last').html(datas['sell_price']);
		}
	});
}
var timer = setInterval(refresh,1000);
//首屏加载结束


//顶部切换
$(".slide-up").click(function(){
    var arrow = $(this).find("a.slide_arrow .icon");
    if(arrow.hasClass("icon_open")){
        arrow.removeClass("icon_open").addClass("icon_close");
    }else if(arrow.hasClass("icon_close")){
        arrow.removeClass("icon_close").addClass("icon_open");
    }
    $(this).next(".slide-down").slideToggle();
});

$('.header-slide .slide-down ul').find('li').click(function(){
		var liTxt = $(this).text();
		$('.slide-up span').html(liTxt);
		$('.slide-down').hide();
});
//顶部切换结束

//左侧弹出
$('.header-left').click(function(){
	$('#see-up').hide();
	$('.pub-content').show();
})
//左侧弹出结束

//动态加载金额列表
//var mongarr=[100,200,500,1000,2000,5000,10000],cenhtml='',crnhtml='';
var mongarr=[50,100,200,500,1000,2000,5000],cenhtml='',crnhtml='';
$.map(mongarr,function(val,i){
	cenhtml+='<li data-value='+val+' data-index='+i+'>'+val+'元</li>';
	crnhtml+='<span class="list-second" data-index='+i+' data-val='+val+' style="display: none;">'+val+'元</span>';
})
$('.monyclick').html(cenhtml);
$('.mongyshow').prepend(crnhtml);
//动态加载金额列表结束

//动态加载时间列表
var timearr=[60,300,900,1800,3600],timelv=[0.76,0.78,0.80,0.82,0.85],timhtml='',txmhtml='';
$.map(timearr,function(val,i){
	timhtml+='<li data-value='+val+' data-index='+i+' data-lv='+timelv[i]+' >'+val+'秒</li>';
	txmhtml+='<span class="list-second" data-index='+i+' data-lv='+timelv[i]+' style="display: none;">'+val+'秒</span>'
})
$('.timeclick').html(timhtml);
$('.timeshow').prepend(txmhtml);
//动态加载时间列表结束

//点击mony psan
$('.list-right2').delegate('span','click',function(){
	$(this).addClass('list-checked').siblings('span').removeClass('list-checked');
	var val=$(this).attr('data-val');
	var spanIndex=$('.timeshow').find('.list-checked').attr('data-lv');
	changeval(spanIndex,val);
})


//点击 time span
$('.list-right').delegate('span','click',function(){
	var spanIndex = $(this).attr('data-lv');
    var mongIndex = $('.mongyshow').find('.list-checked').attr('data-val');
    $(this).addClass('list-checked').siblings('span').removeClass('list-checked');
	changeval(spanIndex,mongIndex);
})

//time click
$('.timeclick').delegate('li','click',function(){
	var index=$(this).attr('data-index'),
		spanindex=$(this).attr('data-lv');
	$('.list-right').find('.list-second').hide().removeClass('list-checked');
	$('.list-right').find('.list-second').eq(index).show().addClass('list-checked');
	if(index<3){
		$('.list-right').find('.list-second').eq(0).show();
		$('.list-right').find('.list-second').eq(1).show();
		$('.list-right').find('.list-second').eq(2).show();
	}
	$('.dialog-right').hide();
	var mongIndex = $('.mongyshow').find('.list-checked').attr('data-val');
	changeval(spanindex,mongIndex);
})


//mony click
$('.monyclick').delegate('li','click',function(){
	var index=$(this).attr('data-index');
	$('.list-right2').find('.list-second').hide().removeClass('list-checked');
	$('.list-right2').find('.list-second').eq(index).show().addClass('list-checked');
	if(index<5 && index>1){
		$('.list-right2').find('.list-second').eq(2).show();
		$('.list-right2').find('.list-second').eq(3).show();
		$('.list-right2').find('.list-second').eq(4).show();
	}else if(index<2 || index>4){
        $('.list-right2').find('.list-second').eq(2).hide();
		$('.list-right2').find('.list-second').eq(3).hide();
		$('.list-right2').find('.list-second').eq(4).hide();
    }
	$('.dialog-right2').hide();
	var mongIndex = $('.mongyshow').find('.list-checked').attr('data-val');
	var panindex  = $('.timeshow').find('.list-checked').attr('data-lv');
	changeval(panindex,mongIndex);
})

//修改条件选择金额
function changeval(spanIndex,mongIndex){
	var lv=parseFloat(spanIndex);
	$('#earn-rate').html(lv*100+'%');
	var mo=parseInt(mongIndex);
	$('#earn').html((mo+mo*lv)+'元');
}


//显示看涨看跌弹窗
$('.xshow').click(function(){
	$('.pub-content').hide();//隐藏当前显示
	$('#see-up').show();//显示弹窗
	var zhangdie=$(this).attr('data-val');//获取点击的买涨买跌
	$('#see-up').find('.order-action').attr('data-zhangdie',zhangdie);//设置点击涨跌
	if(zhangdie=='0'){
		$('#see-up').find('.order-action').find('span').eq(1).show();
		$('#see-up').find('.order-action').find('span').eq(0).hide();
	}else if(zhangdie=='1'){
		$('#see-up').find('.order-action').find('span').eq(1).hide();
		$('#see-up').find('.order-action').find('span').eq(0).show();
	};

	$('.timeshow').find('.list-second').each(function(){
		$(this).removeClass('list-checked').hide();
	});
	$('.timeshow').find('.list-second').eq(0).addClass('list-checked').show();
	$('.timeshow').find('.list-second').eq(1).show();
	$('.timeshow').find('.list-second').eq(2).show();

	$('.mongyshow').find('.list-second').each(function(){
		$(this).removeClass('list-checked').hide();
	});
	$('.mongyshow').find('.list-second').eq(2).addClass('list-checked').show();
	$('.mongyshow').find('.list-second').eq(3).show();
	$('.mongyshow').find('.list-second').eq(4).show();


	var mongIndex = $('.mongyshow').find('.list-checked').attr('data-val');
	var panindex  = $('.timeshow').find('.list-checked').attr('data-lv');
	changeval(panindex,mongIndex);
});
//买涨跌AJAX
$('.order-click').each(function(){
	$(this).click(function(){
		$(this).hide();
		var heuyueid=$(this).parent().attr('data-heyueid'),//合约id
		zhangdie=$(this).parent().attr('data-zhangdie'),//涨0   跌1
		time=parseInt($('.timeshow').find('.list-checked').html()),//60秒-3600秒
		mong=parseInt($('.mongyshow').find('.list-checked').html()),//多少钱
		shouyi=parseInt($('#earn-rate').html())/100;
		var url="{:U('EuroOption/order_insert')}";
		$.ajax({
			type:"post",
			data:{
				option_id:heuyueid,
				direction:zhangdie,
				duration:time,
				invest:mong,
				yield_rate:shouyi
			},
			url:url,
			async:true,
			success:function(data){
				if(data['status']==1){
					$('.msg').html(data['info']);
					$('.msgok').attr('res',1);
					$('.showmsgbox').show();
					var dl=parseFloat($('.pub-yuen').html())- parseFloat(mong);
					$('.pub-yuen').html(dl.toFixed(2));
					domeAJAX();
				}else{
					$('.msg').html(data['info']);
					$('.msgok').attr('res',0);
					$('.showmsgbox').show();
					if(zhangdie=='0'){
						$('.order-click').eq(1).show();
					}else if(zhangdie=='1'){
						$('.order-click').eq(0).show();
					}
				};
			}
		});//发送
	});
});
//提示信息
$('.msgok').click(function(){
	var res = $(this).attr('res');
	if(res==1){
		$('#see-up').hide();
		$('.showmsgbox').hide();
		$('.pub-tab-menu ul li').eq(1).addClass('pub-cur').siblings('li').removeClass('pub-cur');
    	$('.pub-tab-content').find('.pub-order-list').eq(1).show().siblings().hide();
    	$('.pub-content').show();
	}else{
		$('.showmsgbox').hide();
	}

})
$('.list-right .right-select img').click(function(){
	$('.dialog-right').show();
});
$('.list-right2 .right-select2 img').click(function(){
	$('.dialog-right2').show();
});
//切换
$('.pub-tab-menu ul li').click(function(){
    var index = $(this).index();
    $('.pub-tab-menu ul li').eq(index).addClass('pub-cur').siblings('li').removeClass('pub-cur');
    $('.pub-tab-content').find('.pub-order-list').eq(index).show().siblings().hide();
    if(index==2){
    	overAJAX();
    }
})

//dome节点拼接
function domeAJAX(index){

	var url="{:U('EuroOption/load_ongoing')}";
    //第一次加载
    $.ajax({
		type:"post",
		url:url,
		dataType:'json',
		async:true,
		success:function(data){
			$('.pub-order-list').eq(1).html("");
			var kle='';
			for(var i=0;i<data.length;i++){
				kle+='<div class="order-list-gro clearfix order-lists" id='+data[i]["id"]+'>'+
								'<p class="pub-title"><span class="title-name">'+data[i]["option_name"]+'</span><span class="title-date" cur-time='+data[i]['cur_time']+'  data-time = '+data[i]['shen']+' data-over='+data[i]["duration"]+'><span>'+data[i]["format_start_time"]+'</span></span></p>'+
								'<div class="order-square clearfix">'+
									'<dl>'+
										'<dd>'+
											'<div class="square-info">'+
												'<p data-direction='+data[i]["direction"]+'>'+data[i]["direction_str"]+'</p>'+
												'<p>金额<span>'+data[i]["invest"]+'</span>元</p>'+
												'<p>收益<span>'+data[i]["yield_rate"]*100+'</span>%</p>'+
												'<p>剩余'+
													'<div class="elapsed"></div>'+
												'</p>'+
											'</div>'+
										'</dd>'+
										'<dd>'+
											'<div class="square-profit">'+
												'<p>盈亏<span>'+data[i]['profit']+'</span>元</p>'+
												'<p>执行价<span>'+data[i]["buy_price"]+'</span></p>'+
												'<p>当前价<span></span></p>'+
													'<div class="percent">'+
														'<div class="pbar"></div>'+
														'<b></b>'+
													'</div>'+
											'</div>'+
										'</dd>'+
										'<dd>'+
											'<a href="#" class="square-btn-doing">进行中</a>'+
										'</dd>'+
									'</dl>'+
								'</div>'+
							'</div>';
			};
			$('.pub-order-list').eq(1).html(kle);
			add();
		}
	});
};
domeAJAX();
//初始显示在页面的进度条
function add(){
	$('.order-lists').each(function(){
	var self=this;
	var shen=parseInt($(this).find('.pub-title').find('.title-date').attr('data-time')),
	cur_time=parseInt($(this).find('.pub-title').find('.title-date').attr('cur-time')),
	go	         =parseInt($(this).find('.pub-title').find('.title-date').attr('data-over'))
	anmin(self,go,shen);
	//刷新当前价 盈利
	Refresh()
	});
}
function Refresh(){
var yldq=setInterval(function(){
	var currentt=0;//总盈亏
	$('.order-lists').each(function(){
		var	now=parseFloat($('.stock-fund').html()).toFixed(5),//当前价格
			dangqianjia=parseFloat($(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(1).find('span').html()),//买入价格
			zijin=parseFloat($(this).find('.order-square').find('dd').eq(0).find('.square-info').find('p').eq(1).find('span').html()),//投入资金
			profit=parseFloat($(this).find('.order-square').find('dd').eq(0).find('.square-info').find('p').eq(2).find('span').html()),//收益率
			direction=$(this).find('.order-square').find('dd').eq(0).find('.square-info').find('p').eq(0).attr('data-direction');//方向
//		console.log('当前价格/'+now+'*** 买入价格/'+dangqianjia+'*** 收益率/'+profit+'*** 方向/'+direction);
		$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(2).find('span').html(now);//当前价
		if(direction=='1'){
			$(this).find('.order-square').find('dd').eq(0).find('.square-info').find('p').eq(0).removeClass('pub-bluecolor').addClass('pub-redcolor');
			var linepic=now-dangqianjia;
			if(linepic>0){
				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).removeClass('pub-bluecolor').addClass('pub-redcolor');//盈亏537
 				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).find('span').html('+'+(zijin*profit/100+zijin));
 				currentt=currentt+zijin*profit/100+zijin;
			}else if(linepic<0){
				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).removeClass('pub-redcolor').addClass('pub-bluecolor');//盈亏537
 				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).find('span').html('-'+zijin);
 				currentt=currentt-zijin;
			}else if(linepic=0){
				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).removeClass('pub-redcolor').addClass('pub-bluecolor');//盈亏537
 				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).find('span').html('0');
 				currentt=currentt;
			}
		}else if(direction=='0'){
			$(this).find('.order-square').find('dd').eq(0).find('.square-info').find('p').eq(0).removeClass('pub-redcolor').addClass('pub-bluecolor');
			var linepic=dangqianjia-now;
			if(linepic>0){
				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).removeClass('pub-bluecolor').addClass('pub-redcolor');//盈亏537
 				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).find('span').html('+'+(zijin*profit/100+zijin));
 				currentt=currentt+zijin*profit/100+zijin;
			}else if(linepic<0){
				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).removeClass('pub-redcolor').addClass('pub-bluecolor');//盈亏537
 				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).find('span').html('-'+zijin);
 				currentt=currentt-zijin;
			}else if(linepic=0){
				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).removeClass('pub-redcolor').addClass('pub-bluecolor');//盈亏537
 				$(this).find('.order-square').find('dd').eq(1).find('.square-profit').find('p').eq(0).find('span').html('0');
 				currentt=currentt;
			}
		};
//		console.log(currentt);
	});
	if(currentt>0){
		$('.funding').removeClass('pub-bluecolor').addClass('pub-redcolor');
	}else{
		$('.funding').removeClass('pub-redcolor').addClass('pub-bluecolor');
	}
	$('.funding').html(currentt.toFixed(2)+'元');
 },1000)
}
//计时
function anmin(self,going,shen){
var jindu	 =$(self).find('.order-square').find('dd').eq(1).find('.square-profit').find('.percent'),
	jindutext=$(self).find('.order-square').find('dd').eq(1).find('.square-profit').find('.pbar'),
	jindub   =$(self).find('.order-square').find('dd').eq(1).find('.square-profit').find('b'),
	jindus   =$(self).find('.order-square').find('dd').eq(0).find('.square-info').find('.elapsed');
var vInterval = setInterval(function(){
	if(shen<0){
		shen = 0;
		clearInterval(vInterval);
		$(self).remove();
	}
	jindus.html(shen+'秒');
	var pic=parseInt((going-shen)/going*100);
	jindutext.css('width',pic+'%');
	jindub.html(pic+'%');
	shen--;
	// if(pic>100){
	// 	clearInterval(vInterval);
	// 	var url="{:U('StockOption/load_over')}";
	// 	$(self).remove();
	// };

	},1000)
};
//结算AJAX
function overAJAX(){
	var url="{:U('EuroOption/load_over')}";
	//var page=$('.pub-order-list').eq(2).find('div').eq(0).attr("data-page");
	var page=1;
	$.ajax({
		type:"post",
		dataType:'json',
		url:url,
		async:true,
		success:function(data){
		if(data.length==0){
			$(".jiesuanas").text("你还没有交易。。。");
			return;
		}
			$('.pub-order-list').eq(2).find('div').eq(0).find('.order-list-gro').remove();
			var olps='';
			for(var i=0;i<data.length;i++){
				olps+='<div class="order-list-gro clearfix ">'+
									'<p class="pub-title"><span class="title-name">'+data[i]['option_name']+'</span><span class="title-date" >开仓'+data[i]['format_start_time']+'</span></p>'+
									'<div class="order-square clearfix">'+
										'<dl>'+
											'<dd>'+
												'<div class="square-info">'+
													'<p>'+data[i]['direction_str']+'</p>'+
													'<p>金额'+data[i]['invest']+'元</p>'+
													'<p>收益'+data[i]['yield_rate']*100+'%  </p>'+
													'<p>时长'+data[i]['duration']+'秒  </p>'+
												'</div>'+
											'</dd>'+
											'<dd>'+
												'<div class="square-profit">'+
													'<p >盈亏'+data[i]['profit']+'元</p>'+
													'<p>执行价'+data[i]['buy_price']+'</p>'+
													'<p>到期价'+data[i]['sell_price']+'</p>'+
													'<p>到期时间'+data[i]['format_end_time']+'</p>'+
												'</div>'+
											'</dd>'+
											'<dd>'+
												'<a href="#" class="square-btn">结算成功</a>'+
											'</dd>'+
										'</dl>'+
									'</div>'+
								'</div>';
			};
			$('.pub-order-list').eq(2).find('div').eq(0).html(olps);
			$('.pub-order-list').eq(2).find('div').eq(0).attr("data-page",page);
		}
	});
};
overAJAX();

$('.jiesuanas').click(function(){
	var url="{:U('EuroOption/load_over')}";
	var page=$('.pub-order-list').eq(2).find('div').eq(0).attr("data-page");
	  var a1=$('.pub-order-list').eq(2).find('div').eq(0).html();//原来的页面
	page=parseInt(page)+1;
	$.ajax({
		type:"post",
		data:{page:page},
		dataType:'json',
		url:url,
		async:true,
		success:function(data){
		if(data.length==0){
			$(".jiesuanas").text("没有更多了...");
			return;
		}
			var olspd=a1;
			for(var i=0;i<data.length;i++){
				olspd+='<div class="order-list-gro clearfix ">'+
									'<p class="pub-title"><span class="title-name">'+data[i]['option_name']+'</span><span class="title-date" >开仓'+data[i]['format_start_time']+'</span></p>'+
									'<div class="order-square clearfix">'+
										'<dl>'+
											'<dd>'+
												'<div class="square-info">'+
													'<p>'+data[i]['direction_str']+'</p>'+
													'<p>金额'+data[i]['invest']+'元</p>'+
													'<p>收益'+data[i]['yield_rate']*100+'%  </p>'+
													'<p>时长'+data[i]['duration']+'秒  </p>'+
												'</div>'+
											'</dd>'+
											'<dd>'+
												'<div class="square-profit">'+
													'<p >盈亏'+data[i]['profit']+'元</p>'+
													'<p>执行价'+data[i]['buy_price']+'</p>'+
													'<p>到期价'+data[i]['sell_price']+'</p>'+
													'<p>到期时间'+data[i]['format_end_time']+'</p>'+
												'</div>'+
											'</dd>'+
											'<dd>'+
												'<a href="#" class="square-btn">结算成功</a>'+
											'</dd>'+
										'</dl>'+
									'</div>'+
								'</div>';
			};
			$('.pub-order-list').eq(2).find('div').eq(0).html(olspd)
			$('.pub-order-list').eq(2).find('div').eq(0).attr("data-page",page);
		}
	});
})

}//loadover


var urls="{:U('UpdateEuro/fenshi')}";//图标加载的url
</script>
<script type="text/javascript" src="__JS__/svgEuroOption.js"></script>
</html>
